package com.chinasoft.ssm.app;

import com.chinasoft.ssm.config.SpringConfig;
import com.chinasoft.ssm.pojo.Account;
import com.chinasoft.ssm.pojo.TblAccount;
import com.chinasoft.ssm.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

public class MybatisMain {

    public static void main(String[] args) {
       // 初始化容器对象
        ApplicationContext ac = new AnnotationConfigApplicationContext(SpringConfig.class);

        // 获取 bean
        AccountService accountService = ac.getBean(AccountService.class);

        // 执行 service 的方法
        List<TblAccount> accountList = accountService.findAll();

        for (TblAccount account : accountList) {
            System.out.println(account);
        }

    }
}
